package af.fx.base.lesson6;

import javafx.application.Application;
import javafx.application.Platform;
import javafx.collections.ObservableList;
import javafx.geometry.Rectangle2D;
import javafx.stage.Screen;
import javafx.stage.Stage;

/**
 * @Description
 * @Author AF
 * @Version 1.0.0
 * @Date 2024/1/24
 */
public class Main extends Application {

    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage primaryStage) {
        // 获取电脑屏幕列表
//        ObservableList<Screen> screens = Screen.getScreens();

        Screen screen = Screen.getPrimary();

        Rectangle2D rect1 = screen.getBounds();
        // 整个的屏幕的信息
        System.out.println("左上角x=" + rect1.getMinX() + " 左上角y=" + rect1.getMinY());
        System.out.println("右下角x=" + rect1.getMaxX() + " 右下角y="  + rect1.getMaxY());
        System.out.println("宽度=" + rect1.getWidth() + " 高度=" + rect1.getHeight());

        Rectangle2D rect2 = screen.getVisualBounds();
        // 肉眼可见的屏幕信息
        System.out.println("左上角x=" + rect2.getMinX() + " 左上角y=" + rect2.getMinY());
        System.out.println("右下角x=" + rect2.getMaxX() + " 右下角y="  + rect2.getMaxY());
        System.out.println("宽度=" + rect2.getWidth() + " 高度=" + rect2.getHeight());

        double dpi = screen.getDpi();
        System.out.println("像素=" + dpi);
        Platform.exit();
    }
}
